package com.speechb.modules.config;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**EnableSwaggerBootstrapUI http://localhost:8082/doc.html
 *EnableSwagger2-ui http://localhost:8082/swagger-ui.html
 */
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerRestApi {
//swagger2的配置文件，这里可以配置swagger2的一些基本的内容，比如扫描的包等等
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.speechb.controller"))
            .paths(PathSelectors.any())
            .build();
}

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("话术部落RESTful APIs")
                .description("话术部落接口文档")
                .termsOfServiceUrl("http://localhost:8082/")
                .contact("developer@mail.com")
                .version("1.0")
                .build();
    }
 
 
}